<?php


namespace App\Command;


use App\Command\Model\Interview as InterviewModel;
use EchoPHP\Console\Command;
use EchoPHP\Facades\Log;

class Interview extends Command {
    protected $signature = "interview";
    protected $description = '执行面试通知发送任务';

    public function handle() {
        $interviewModel = new InterviewModel();
        try {
            while (null !== $count = $interviewModel->sendNotice()) {
                $this->output->success('已发送一批合计' . $count . '人');
            }
            $this->output->success('所有待发通知已全部发送完成');
        } catch (\Exception $e) {
            Log::error('面试邀请发送出错', ['msg' => $e->getMessage()]);
            $this->output->error($e->getFile() . '(Line:' . $e->getLine() . ')【' . $e->getMessage() . '】');
        }
    }
}